package besta.moon.sql.expression.function.numeric;

import besta.moon.sql.expression.function.FunctionReturnP1Number;
import besta.moon.sql.parser.SQLTokenizer;

public class FunctionFloor extends FunctionReturnP1Number {

    @Override
    public int getFunction() {
        return SQLTokenizer.FLOOR;
    }

    @Override
    public double getDouble() throws Exception {
        return Math.floor(param1.getDouble());
    }

    @Override
    public String getString() throws Exception {
        Object obj = getObject();
        if (obj == null) {
            return null;
        }
        return obj.toString();
    }

}
